.class Landroid/widget/StepListView$MyCursorAdapter;
.super Landroid/widget/CursorAdapter;
.source "StepListView.java"

# interfaces
.implements Landroid/widget/MyAdapterView$OnItemClickListener;
.implements Landroid/widget/MyAbsListView$RecyclerListener;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/widget/StepListView;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "MyCursorAdapter"
.end annotation


# instance fields
.field final synthetic this$0:Landroid/widget/StepListView;


# direct methods
.method constructor <init>(Landroid/widget/StepListView;Landroid/content/Context;Landroid/database/Cursor;)V
    .locals 0
    .parameter
    .parameter "context"
    .parameter "cursor"

    .prologue
    .line 145
    iput-object p1, p0, Landroid/widget/StepListView$MyCursorAdapter;->this$0:Landroid/widget/StepListView;

    .line 146
    invoke-direct {p0, p2, p3}, Landroid/widget/CursorAdapter;-><init>(Landroid/content/Context;Landroid/database/Cursor;)V

    .line 147
    return-void
.end method


# virtual methods
.method public bindView(Landroid/view/View;Landroid/content/Context;Landroid/database/Cursor;)V
    .locals 10
    .parameter "view"
    .parameter "context"
    .parameter "cursor"

    .prologue
    .line 151
    new-instance v0, Lcom/htc/android/footprints/vo/Footprint;

    invoke-direct {v0}, Lcom/htc/android/footprints/vo/Footprint;-><init>()V

    .line 152
    .local v0, footprint:Lcom/htc/android/footprints/vo/Footprint;
    const v4, 0x7f0c008a

    invoke-virtual {p1, v4}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v3

    check-cast v3, Lcom/htc/android/footprints/view/IPictureView;

    .line 154
    .local v3, pView:Lcom/htc/android/footprints/view/IPictureView;
    invoke-static {v0, p3}, Lcom/htc/android/footprints/provider/FootprintManager;->fillDataFromCursor(Lcom/htc/android/footprints/vo/Footprint;Landroid/database/Cursor;)V

    .line 159
    const-wide/16 v4, 0x5

    invoke-static {}, Ljava/lang/Math;->random()D

    move-result-wide v6

    const-wide/high16 v8, 0x4028

    mul-double/2addr v6, v8

    invoke-static {v6, v7}, Ljava/lang/Math;->round(D)J

    move-result-wide v6

    add-long/2addr v4, v6

    long-to-int v1, v4

    .line 160
    .local v1, offsetDegree:I
    invoke-static {}, Ljava/lang/Math;->random()D

    move-result-wide v4

    const-wide/high16 v6, 0x4039

    mul-double/2addr v4, v6

    invoke-static {v4, v5}, Ljava/lang/Math;->round(D)J

    move-result-wide v4

    long-to-int v2, v4

    .line 162
    .local v2, offsetOption:I
    iget-object v4, p0, Landroid/widget/StepListView$MyCursorAdapter;->this$0:Landroid/widget/StepListView;

    #getter for: Landroid/widget/StepListView;->defaultPictureSize:I
    invoke-static {v4}, Landroid/widget/StepListView;->access$000(Landroid/widget/StepListView;)I

    move-result v4

    invoke-interface {v3, v4}, Lcom/htc/android/footprints/view/IPictureView;->setDefaultPictureSize(I)V

    .line 163
    invoke-interface {p3}, Landroid/database/Cursor;->getPosition()I

    move-result v4

    rem-int/lit8 v4, v4, 0x2

    if-nez v4, :cond_0

    .line 164
    neg-int v4, v1

    invoke-interface {v3, v0, v4, v2}, Lcom/htc/android/footprints/view/IPictureView;->setFootprint(Lcom/htc/android/footprints/vo/Footprint;II)V

    .line 172
    :goto_0
    return-void

    .line 166
    :cond_0
    neg-int v4, v2

    invoke-interface {v3, v0, v1, v4}, Lcom/htc/android/footprints/view/IPictureView;->setFootprint(Lcom/htc/android/footprints/vo/Footprint;II)V

    goto :goto_0
.end method

.method public getFootprint(I)Lcom/htc/android/footprints/vo/Footprint;
    .locals 3
    .parameter "position"

    .prologue
    .line 196
    invoke-virtual {p0, p1}, Landroid/widget/StepListView$MyCursorAdapter;->getItem(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/database/Cursor;

    .line 197
    .local v0, cur:Landroid/database/Cursor;
    if-eqz v0, :cond_0

    .line 198
    new-instance v1, Lcom/htc/android/footprints/vo/Footprint;

    invoke-direct {v1}, Lcom/htc/android/footprints/vo/Footprint;-><init>()V

    .line 199
    .local v1, f:Lcom/htc/android/footprints/vo/Footprint;
    invoke-virtual {p0}, Landroid/widget/StepListView$MyCursorAdapter;->getCursor()Landroid/database/Cursor;

    move-result-object v2

    invoke-static {v1, v2}, Lcom/htc/android/footprints/provider/FootprintManager;->fillDataFromCursor(Lcom/htc/android/footprints/vo/Footprint;Landroid/database/Cursor;)V

    move-object v2, v1

    .line 202
    .end local v1           #f:Lcom/htc/android/footprints/vo/Footprint;
    :goto_0
    return-object v2

    :cond_0
    const/4 v2, 0x0

    goto :goto_0
.end method

.method public getFootprints()[Lcom/htc/android/footprints/vo/Footprint;
    .locals 3

    .prologue
    .line 186
    invoke-virtual {p0}, Landroid/widget/StepListView$MyCursorAdapter;->getCount()I

    move-result v2

    new-array v1, v2, [Lcom/htc/android/footprints/vo/Footprint;

    .line 188
    .local v1, result:[Lcom/htc/android/footprints/vo/Footprint;
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    array-length v2, v1

    if-ge v0, v2, :cond_0

    .line 189
    invoke-virtual {p0, v0}, Landroid/widget/StepListView$MyCursorAdapter;->getFootprint(I)Lcom/htc/android/footprints/vo/Footprint;

    move-result-object v2

    aput-object v2, v1, v0

    .line 188
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 192
    :cond_0
    return-object v1
.end method

.method public newView(Landroid/content/Context;Landroid/database/Cursor;Landroid/view/ViewGroup;)Landroid/view/View;
    .locals 5
    .parameter "context"
    .parameter "cursor"
    .parameter "viewgroup"

    .prologue
    .line 176
    invoke-static {p1}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

    move-result-object v2

    const v3, 0x7f03001c

    const/4 v4, 0x0

    invoke-virtual {v2, v3, v4}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v1

    .line 178
    .local v1, resultView:Landroid/view/View;
    const v2, 0x7f0c008a

    invoke-virtual {v1, v2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Lcom/htc/android/footprints/view/IPictureView;

    .line 180
    .local v0, pView:Lcom/htc/android/footprints/view/IPictureView;
    iget-object v2, p0, Landroid/widget/StepListView$MyCursorAdapter;->this$0:Landroid/widget/StepListView;

    #getter for: Landroid/widget/StepListView;->bHandler:Landroid/os/Handler;
    invoke-static {v2}, Landroid/widget/StepListView;->access$100(Landroid/widget/StepListView;)Landroid/os/Handler;

    move-result-object v2

    invoke-interface {v0, v2}, Lcom/htc/android/footprints/view/IPictureView;->setHandler(Landroid/os/Handler;)V

    .line 182
    return-object v1
.end method

.method public onItemClick(Landroid/widget/MyAdapterView;Landroid/view/View;IJ)V
    .locals 3
    .parameter
    .parameter "view"
    .parameter "position"
    .parameter "id"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/widget/MyAdapterView",
            "<*>;",
            "Landroid/view/View;",
            "IJ)V"
        }
    .end annotation

    .prologue
    .line 217
    .local p1, parent:Landroid/widget/MyAdapterView;,"Landroid/widget/MyAdapterView<*>;"
    new-instance v0, Landroid/content/Intent;

    const-string v1, "com.htc.android.footprints.activity.FootprintDetailViewActivity"

    invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 219
    .local v0, intent:Landroid/content/Intent;
    const-string v1, "DATA"

    invoke-virtual {p0, p3}, Landroid/widget/StepListView$MyCursorAdapter;->getFootprint(I)Lcom/htc/android/footprints/vo/Footprint;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)Landroid/content/Intent;

    .line 220
    iget-object v1, p0, Landroid/widget/StepListView$MyCursorAdapter;->this$0:Landroid/widget/StepListView;

    invoke-virtual {v1}, Landroid/widget/StepListView;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-virtual {v1, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    .line 221
    return-void
.end method

.method public onMovedToScrapHeap(Landroid/view/View;)V
    .locals 2
    .parameter "scrapView"

    .prologue
    .line 209
    const v1, 0x7f0c008a

    invoke-virtual {p1, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Lcom/htc/android/footprints/view/IPictureView;

    .line 211
    .local v0, pView:Lcom/htc/android/footprints/view/IPictureView;
    invoke-interface {v0}, Lcom/htc/android/footprints/view/IPictureView;->reset()V

    .line 212
    return-void
.end method
